home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / docme.lha / doc.me / intro.me < prev    next >
Text File  |  1992-09-25  |  38KB  |  1,210 lines

  1. .\" use: pic | tbl | eqn | ditroff -me
  2. .\"
  3. .\"    "@(#)bibmac.me    2.2    9/9/83";
  4. .de IP
  5. .ip \\$1 \\$2
  6. ..
  7. .de LP
  8. .lp
  9. ..
  10. .\"    @(#)bmac.std    2.2    9/9/83;
  11. .\" standard format troff commands
  12. .\" citation formatting strings
  13. .ds [[ [
  14. .ds ]] ]
  15. .ds ], ,\|
  16. .ds ]- -
  17. .ds [. " \&
  18. .ds .] .
  19. .ds [, " \&
  20. .ds ,] ,
  21. .ds [? " \&
  22. .ds ?] ?
  23. .ds [: " \&
  24. .ds :] :
  25. .ds [; " \&
  26. .ds ;] ;
  27. .ds [! " \&
  28. .ds !] !
  29. .ds [" " \&
  30. .ds "] \&"
  31. .ds [' " \&
  32. .ds '] '
  33. .ds [< " \&
  34. .ds >]
  35. .\" reference formmating strings
  36. .ds a] " \&
  37. .ds b] , \&
  38. .ds c] , \&
  39. .ds n] "\& and \&
  40. .ds m] "\& and \&
  41. .ds p] .
  42. .\" reference formmating macros
  43. .de s[   \" start reference
  44. .nh
  45. .IP [\\*([F] 5m
  46. ..
  47. .de e[   \" end reference
  48. .[-
  49. ..
  50. .de []   \" start to display collected references
  51. .LP
  52. ..
  53. .de ][   \" choose format
  54. .ie !"\\*([J"" \{\
  55. .    ie !"\\*([V"" .nr t[ 1    \" journal
  56. .    el            .nr t[ 5    \" conference paper
  57. .\}
  58. .el .ie !"\\*([B"" .nr t[ 3    \" article in book
  59. .el .ie !"\\*([R"" .nr t[ 4    \" technical report
  60. .el .ie !"\\*([I"" .nr t[ 2    \" book
  61. .el                .nr t[ 0    \" other
  62. .\\n(t[[
  63. ..
  64. .de 0[   \" other
  65. .s[
  66. .if !"\\*([A"" \\*([A\\c
  67. .if !"\\*([T"" , \\*([T\\c
  68. .if !"\\*([V"" , Vol. \\*([V\\c
  69. .if !"\\*([O"" , \\*([O\\c
  70. .if !"\\*([D"" , \\*([D\\c
  71. \&.
  72. .e[
  73. ..
  74. .de 1[ \" journal article
  75. .s[
  76. .if !"\\*([A"" \\*([A,
  77. .if !"\\*([T""  \\*([T,
  78. \\fI\\*([J \\*([V\\fP\c
  79. .if !"\\*([N"" ,\\*([N
  80. .if !"\\*([D"" (\\*([D)\c
  81. .if !"\\*([P"" , \\*([P\c
  82. .if !"\\*([I"" , \\*([I\c
  83. \\&.
  84. .if !"\\*([O"" \\*([O.
  85. .e[
  86. ..
  87. .de 2[ \" book
  88. .s[
  89. .ie !"\\*([A"" \\*([A,
  90. .el .if !"\\*([E"" \{\
  91. .       ie \\n([E-1 \\*([E, eds.,
  92. .       el \\*([E, ed.,\}
  93. .if !"\\*([T"" \\fI\\*([T\\fP,
  94. .rm a[
  95. .if !"\\*([I"" .ds a[ \\*([I
  96. .if !"\\*([C"" \{\
  97. .       if !"\\*(a["" .as a[ , \\&
  98. .       as a[ \\*([C\}
  99. .if !"\\*([D"" \{\
  100. .       if !"\\*(a["" .as a[ , \\&
  101. .       as a[ \\*([D\}
  102. \\*(a[.
  103. .if !"\\*([G"" Gov. ordering no. \\*([G.
  104. .if !"\\*([O"" \\*([O.
  105. .e[
  106. ..
  107. .de 3[ \" article in book
  108. .s[
  109. .if !"\\*([A"" \\*([A,
  110. .if !"\\*([T"" \\*([T,
  111. in \\fI\\*([B\\fP\c
  112. .if !"\\*([V"" , vol. \\*([V
  113. .if !~\\*([E~~ \{\
  114. .       ie , \\n([E-1  \\*([E (editors)\c
  115. .       el , \\*([E (editor)\c\}
  116. .if !"\\*([I"" , \\*([I\c
  117. .if !"\\*([C"" , \\*([C\c
  118. .if !"\\*([D"" , \\*([D\c
  119. .if !"\\*([P"" , \\*([P\c
  120. \\&.
  121. .if !"\\*([O"" \\*([O.
  122. .e[
  123. ..
  124. .de 4[ \" report
  125. .s[
  126. .if !"\\*([A"" \\*([A,
  127. .if !~\\*([E~~ \{\
  128. .       ie \\n([E-1 \\*([E, editors.
  129. .       el \\*([E, editor.\}
  130. \\*([T,
  131. \\*([R\c
  132. .if !"\\*([G"" \& (\\*([G)\c
  133. .if !"\\*([I"" , \\*([I\c
  134. .if !"\\*([C"" , \\*([C\c
  135. .if !"\\*([D"" , \\*([D\c
  136. \\&.
  137. .if !"\\*([O"" \\*([O.
  138. .e[
  139. ..
  140. .de 5[ \" conference paper
  141. .s[
  142. .if !"\\*([A"" \\*([A,
  143. .if !"\\*([T"" \\*([T,
  144. \\fI\\*([J\\fP,
  145. .if !"\\*([C"" \\*([C,
  146. .if !"\\*([D"" \\*([D\c
  147. .if !"\\*([P"" , \\*([P\c
  148. \\&.
  149. .if !"\\*([O"" \\*([O.
  150. .e[
  151. ..
  152. .de [-   \" clean up after yourself
  153. .rm [A [B [C [D
  154. .rm [E [F [G
  155. .rm [I [J [K
  156. .rm [N [O [P
  157. .rm [R [T
  158. .rm [V [W
  159. ..
  160. .\"    @(#)bmac.std    2.2    8/24/83;
  161. .\" standard format troff commands
  162. .\" citation formatting strings
  163. .ds [[ [
  164. .ds ]] ]
  165. .ds ], ,\|
  166. .ds ]- -
  167. .ds [. " \&
  168. .ds .] .
  169. .ds [, " \&
  170. .ds ,] ,
  171. .ds [< " \&
  172. .ds >]
  173. .\" reference formmating strings
  174. .ds c] , \&
  175. .ds n] "" and \&
  176. .ds m] "" and \&
  177. .ds a] " \&
  178. .\" reference formmating macros
  179. .de s[   \" start reference
  180. .nh
  181. .IP [\\*([F] 5m
  182. ..
  183. .de e[   \" end reference
  184. .[-
  185. ..
  186. .de []   \" start to display collected references
  187. .SH
  188. References
  189. .LP
  190. ..
  191. .de ][   \" choose format
  192. .ie !"\\*([J"" \{\
  193. .    ie !"\\*([V"" .nr t[ 1    \" journal
  194. .    el            .nr t[ 5    \" conference paper
  195. .\}
  196. .el .ie !"\\*([B"" .nr t[ 3    \" article in book
  197. .el .ie !"\\*([R"" .nr t[ 4    \" technical report
  198. .el .ie !"\\*([I"" .nr t[ 2    \" book
  199. .el                .nr t[ 0    \" other
  200. .\\n(t[[
  201. ..
  202. .de 0[   \" other
  203. .s[
  204. .if !"\\*([A"" \\*([A,
  205. .if !"\\*([T"" \\*([T,
  206. .if !"\\*([O"" \\*([O\c
  207. .if !"\\*([D"" , \\*([D\c
  208. \&.
  209. .e[
  210. ..
  211. .de 1[ \" journal article
  212. .s[
  213. .if !"\\*([A"" \\*([A,
  214. .if !"\\*([T"" \\*([T,
  215. \\fI\\*([J \\*([V\\fP,
  216. .if !"\\*([N"" \\*([N
  217. .if !"\\*([D"" (\\*([D),
  218. .if !"\\*([P"" \\*([P\c
  219. .if !"\\*([I"" , \\*([I\c
  220. \\&.
  221. .if !"\\*([O"" \\*([O.
  222. .e[
  223. ..
  224. .de 2[ \" book
  225. .s[
  226. .ie !"\\*([A"" \\*([A,
  227. .el .if !"\\*([E"" \{\
  228. .       ie \\n([E-1 \\*([E, eds.,
  229. .       el \\*([E, ed.,\}
  230. .if !"\\*([T"" \\fI\\*([T\\fP,
  231. .rm a[
  232. .if !"\\*([I"" .ds a[ \\*([I
  233. .if !"\\*([C"" \{\
  234. .       if !"\\*(a["" .as a[ , \\&
  235. .       as a[ \\*([C\}
  236. .if !"\\*([D"" \{\
  237. .       if !"\\*(a["" .as a[ , \\&
  238. .       as a[ \\*([D\}
  239. \\*(a[.
  240. .if !"\\*([G"" Gov. ordering no. \\*([G.
  241. .if !"\\*([O"" \\*([O.
  242. .e[
  243. ..
  244. .de 3[ \" article in book
  245. .s[
  246. .if !"\\*([A"" \\*([A,
  247. .if !"\\*([T"" \\*([T,
  248. in \\fI\\*([B\\fP,
  249. .if !"\\*([V"" vol. \\*([V,
  250. .if !"\\*([E"" \\*([E (ed.),
  251. .if !"\\*([I"" \\*([I,
  252. .if !"\\*([C"" \\*([C,
  253. .if !"\\*([D"" \\*([D\c
  254. .if !"\\*([P"" , \\*([P\c
  255. \\&.
  256. .if !"\\*([O"" \\*([O.
  257. .e[
  258. ..
  259. .de 4[ \" report
  260. .s[
  261. .if !"\\*([A"" \\*([A,
  262. \\*([T,
  263. \\*([R\c
  264. .if !"\\*([G"" \& (\\*([G)\c
  265. .if !"\\*([I"" , \\*([I\c
  266. .if !"\\*([C"" , \\*([C\c
  267. .if !"\\*([D"" , \\*([D\c
  268. \\&.
  269. .if !"\\*([O"" , \\*([O.
  270. .e[
  271. ..
  272. .de 5[ \" conference paper
  273. .s[
  274. .if !"\\*([A"" \\*([A,
  275. .if !"\\*([T"" \\*([T,
  276. \\fI\\*([J\\fP,
  277. .if !"\\*([C"" \\*([C\c
  278. .if !"\\*([D"" , \\*([D\c
  279. .if !"\\*([P"" , \\*([P\c
  280. \\&.
  281. .if !"\\*([O"" , \\*([O.
  282. .e[
  283. ..
  284. .de [-   \" clean up after yourself
  285. .rm [A [B [C [D
  286. .rm [E [F [G
  287. .rm [I [J [K
  288. .rm [N [O [P
  289. .rm [R [T
  290. .rm [V [W
  291. ..
  292. .if t \{ \
  293. .pl 29.7c    \" page length
  294. .po 2.5c    \" page offset (left margin)
  295. .ll 16.5c    \" line length
  296. .lt 16.5c    \" title length
  297. .nr LL 16.5c
  298. .nr )l 29.7c
  299. .nr hm 2c
  300. .nr $r 9    \" factor for vertical spacing
  301. .nr $R \n($r
  302. .sz 12        \" font size
  303. .nr pp 12
  304. .nr sp 12
  305. .nr tp 12
  306. .nr fp 10
  307. .hc ~        \" hyphenation character
  308. .        \" Umlauts and sharp s
  309. .ds A \(A:
  310. .ds O \(O:
  311. .ds U \(U:
  312. .ds a \(a:
  313. .ds o \(o:
  314. .ds u \(u:
  315. .ds s \(ss
  316. .        \"  UMLAUT  \*:u, etc.
  317. .ds : \v'-0.6m'\h'(1u-(\\n(.fu%2u))*0.13m+0.06m'\z.\h'0.2m'\z.\h'-((1u-(\\n(.fu%2u))*0.13m+0.26m)'\v'0.6m'
  318. .\}
  319. .if n \{ \
  320. .po 0        \" page offset (left margin)
  321. .ll 78        \" line length
  322. .lt 78        \" title length
  323. .nr $r 4    \" factor for vertical spacing
  324. .nr $R \n($r
  325. .hc ~        \" hyphenation character
  326. .        \" Umlaute und scharfes s
  327. .ds A Ae
  328. .ds O Oe
  329. .ds U Ue
  330. .ds a ae
  331. .ds o oe
  332. .ds u ue
  333. .ds s sz
  334. .\}
  335. .de _
  336. \&\\$1\l'|0\(ul'\\$2
  337. ..
  338. .de FT        \" font for programs
  339. .ft C
  340. .sz -2
  341. ..
  342. .de FR
  343. .ft R
  344. .sz +2
  345. ..
  346. .de []        \" start to display collected references
  347. .uh References
  348. .lp
  349. ..
  350. .de $0        \" collect table of contents
  351. .(x
  352. .ta 2c
  353. .ie '\\$2''    \\$1
  354. .el \\$2.    \\$1
  355. .)x
  356. ..
  357. .de np
  358. .nr $p +1
  359. .ip \\n($p.
  360. ..
  361. .de SH
  362. .sp 0.5
  363. .in -3
  364. .r \\$1
  365. .sp 0.5
  366. .in +3
  367. ..
  368. .de PP
  369. .sp 0.5
  370. ..
  371. .de IP
  372. .ip \\$1 \\$2
  373. ..
  374. .de I
  375. .i \\$1
  376. ..
  377. .de TH
  378. ..
  379. .EQ
  380. delim off
  381. .EN
  382. .hc ~
  383. .ds ], , 
  384. .b " "
  385. .sp 1c
  386. .ta 9c
  387. .ft R
  388. .sz 12
  389. \l'17.1c'
  390. .nf
  391.  
  392.  
  393.     Toolbox Introduction
  394.  
  395.  
  396.     J. Grosch
  397.  
  398.  
  399. \l'17.1c'
  400. .sp 12.5c
  401. \l'17.1c'
  402. .ft H
  403. .nf
  404.     GESELLSCHAFT F\*UR MATHEMATIK
  405.     UND DATENVERARBEITUNG MBH
  406.  
  407.     FORSCHUNGSSTELLE F\*UR
  408.     PROGRAMMSTRUKTUREN
  409.     AN DER UNIVERSIT\*AT KARLSRUHE
  410. .r
  411. \l'17.1c'
  412. .bp
  413. .oh '''%'
  414. .eh '''%'
  415. .ce 99
  416. .sz 20
  417. .b " "
  418. .sp 2
  419. Project
  420. .sp
  421. .b "Compiler Generation"
  422. .sp
  423. .sz 12
  424. \l'15c'
  425. .sp
  426. .sz 16
  427. .b "Toolbox Introduction"
  428. .sp 2
  429. Josef Grosch
  430. .sp 2
  431. .sz 14
  432. Aug. 3, 1992
  433. .sp
  434. .sz 12
  435. \l'15c'
  436. .sp 2
  437. Report No. 25
  438. .sp 2
  439. Copyright \(co 1992 GMD
  440. .sp 2
  441. Gesellschaft f\*ur Mathematik und Datenverarbeitung mbH
  442. Forschungsstelle an der Universit\*at Karlsruhe
  443. Vincenz-Prie\*snitz-Str. 1
  444. D-7500 Karlsruhe
  445. .ce 0
  446. .fi
  447. .bp 1
  448. .ce 99
  449. .b "Toolbox Introduction"
  450. .\" .sp 2
  451. .\" Josef Grosch
  452. .\" GMD Forschungsstelle an der Universit\*at Karlsruhe
  453. .\" Vincenz-Prie\*snitz-Str. 1, D-7500 Karlsruhe, Germany
  454. .\" grosch@karlsruhe.gmd.de
  455. .ce 0
  456. .uh Abstract
  457. .lp
  458. This document introduces into the usage of the Karlsruhe Toolbox for Compiler Construction.
  459. It should be read by those who effectively want to use the toolbox as first document.
  460. Those who want to learn about the toolbox and its contents in general are referred
  461. to the document "A Toolbox for Compiler Construction".
  462. .lp
  463. This document gives an overview about the documentation of the toolbox. It describes
  464. how the individual tools interact in order to generate a complete compiler. The general
  465. structure of a makefile to control the tools is discussed.
  466. .(z L
  467. .ce
  468. Table 1: Document Set
  469. .sp 0.5
  470. .TS
  471. center box;
  472. l | l | n.
  473. Filename    Title    Pages
  474. _
  475. intro    Toolbox Introduction    12
  476. toolbox    A Tool Box for Compiler Construction    11
  477. werkzeuge    Werkzeuge f\*ur den \*Ubersetzerbau    12
  478. reuse    Reusable Software - A Collection of Modula-2-Modules    24
  479. reuseC    Reusable Software - A Collection of C-Modules    12
  480. prepro    Preprocessors    14
  481. rex    Rex - A Scanner Generator    32
  482. scanex    Selected Examples of Scanner Specifications    21
  483. scangen    Efficient Generation of Table-Driven Scanners    15
  484. lalr-ell    The Parser Generators Lalr and Ell    43
  485. lalr    Lalr - A Generator for Efficient Parsers    22
  486. ell    Efficient and Comfortable Error Recovery in Recursive Descent Parsers    15
  487. highspeed    Generators for High-Speed Front-Ends    12
  488. autogen    Automatische Generierung effizienter Compiler    10
  489. ast    Ast - A Generator for Abstract Syntax Trees    36
  490. toolsupp    Tool Support for Data Structures    11
  491. ag    Ag - An Attribute Evaluator Generator    27
  492. ooags    Object-Oriented Attribute Grammars    10
  493. multiple    Multiple Inheritance in Object-Oriented Attribute Grammars    10
  494. puma    Puma - A Generator for the Transformation of Attributed Trees    29
  495. trafo    Transformation of Attributed Trees Using Pattern Matching    16
  496. minilax    Specification of a MiniLAX-Interpreter    35
  497. begmanual    BEG - a Back End Generator - User Manual    71
  498. mtc    Entwurf und Implementierung eines \*Ubersetzers von Modula-2 nach C    105
  499. estra    Spezifikation und Implementierung der Transformation attributierter B\*aume    79
  500. .TE
  501. .)z
  502. .sh 1 "Document Overview"
  503. .lp
  504. The documentation of the Karlsruhe Toolbox for Compiler Construction consists of separate
  505. user's manuals for the individual tools and additional papers describing further aspects such
  506. as implementation details, examples, and applications.
  507. The documents are written in English. For a few of them there are German versions as well.
  508. Only the two master thesis about \fIestra\fP and \fImtc\fP exist in German, only.
  509. .sh 2 Format
  510. .lp
  511. The documents exist in two formats: Postscript and troff. These are distinguished by the file
  512. suffixes .ps and .me. The troff files need processing with \fIpic\fP and the device independent
  513. version of troff called \fIditroff\fP using me-macros by commands like
  514. .(b
  515. .FT
  516. pic | tbl | eqn | ditroff -me
  517. .)b
  518. Depending on the format the documents are located in the directories doc.ps or doc.me.
  519. .sh 2 Documents
  520. .lp
  521. Table 1 lists the titles of the documents, the corresponding filenames (without suffix),
  522. and the number of pages.
  523. .sh 2 Outlines
  524. .lp
  525. In the following the contents of every document is outlined shortly:
  526. .ip "Toolbox Introduction"
  527. An introduction for effective users of the toolbox which should be consulted first.
  528. It gives an overview about the document set and describes how the tools interact.
  529. .ip "A Tool Box for Compiler Construction"
  530. Explains the contents of the toolbox and the underlying design. The individual tools are
  531. sketched shortly and some application experiences are reported.
  532. .ip "Werkzeuge f\*ur den \*Ubersetzerbau"
  533. A German version of the previous document.
  534. .ip "Reusable Software - A Collection of Modula-2-Modules"
  535. Describes a library of general routines written in Modula-2 which are oriented towards
  536. compiler construction. The output of some tools has to be linked with this library.
  537. .ip "Reusable Software - A Collection of C-Modules"
  538. Describes a library of general routines written in C which are oriented towards
  539. compiler construction. The output of some tools has to be linked with this library.
  540. .ip "Preprocessors"
  541. Describes several preprocessors for the extraction of scanner specifications out of parser
  542. specifications and for the conversion of \fIlex\fP/\fIyacc\fP input to \fIrex\fP/\fIlalr\fP
  543. input or vice versa. There are seven preprocessors:
  544. .(b
  545. cg -xz    converts an attribute grammar to \fIlalr\fP input
  546. rpp    combines a grammar and a scanner specification to \fIrex\fP input
  547. l2r    converts \fIlex\fP input to \fIrex\fP input
  548. y2l    converts \fIyacc\fP input to \fIlalr\fP input
  549. r2l    converts \fIrex\fP input to \fIlex\fP input
  550. cg -u    converts an attribute grammar to \fIyacc\fP input
  551. bnf    converts a grammar from EBNF to BNF
  552. .)b
  553. .ip "Rex - A Scanner Generator"
  554. The user's manual for the scanner generator \fIrex\fP.
  555. .ip "Selected Examples of Scanner Specifications"
  556. A collection of scanner specifications for \fIrex\fP dealing mostly with pathological cases.
  557. .ip "Efficient Generation of Table-Driven Scanners"
  558. Describes internals of the scanner generator \fIrex\fP like the so-called tunnel
  559. automaton and the linear time algorithm for constant regular expressions.
  560. .ip "The Parser Generators Lalr and Ell"
  561. The user's manual for the LALR(1) parser generator \fIlalr\fP and the
  562. LL(1) parser generator \fIell\fP. It describes among other things the input language common to both
  563. generators.
  564. .ip "Lalr - A Generator for Efficient Parsers"
  565. Describes details of the implementation of the parsers generated by \fIlalr\fP and further
  566. outstanding features of this tool.
  567. .ip "Efficient and Comfortable Error Recovery in Recursive Descent Parsers"
  568. Describes the implementation of the parsers generated by \fIell\fP especially with respect to
  569. automatic error recovery.
  570. .ip "Generators for High-Speed Front-Ends"
  571. A summary of the highlights of the scanner and parser generators and a comparison to
  572. \fIlex\fP/\fIyacc\fP and \fIflex\fP/\fIbison\fP.
  573. .ip "Automatische Generierung effizienter Compiler"
  574. A German version of the previous document.
  575. .ip "Ast - A Generator for Abstract Syntax Trees"
  576. The user's manual of \fIast\fP, a tool supporting the definition and manipulation of attributed
  577. trees and graphs.
  578. .ip "Tool Support for Data Structures"
  579. Also describes \fIast\fP, but less precise than the previous document.
  580. .ip "Ag - An Attribute Evaluator Generator"
  581. The user's manual of \fIag\fP, a generator for evaluators of ordered attribute grammars (OAG).
  582. .ip "Object-Oriented Attribute Grammars"
  583. Also describes \fIag\fP, like the previous document, with emphasis on the object-oriented
  584. features.
  585. .ip "Multiple Inheritance in Object-Oriented Attribute Grammars"
  586. Extends the object-oriented attribute grammars described in the previous document to
  587. multiple inheritance.
  588. .ip "Spezifikation und Implementierung der Transformation attributierter B\*aume"
  589. Diploma thesis in German about the design and implementation of \fIestra\fP, a generator for the
  590. transformation of attributed trees.
  591. .ip "Puma - A Generator for the Transformation of Attributed Trees"
  592. The user's manual of \fIpuma\fP, a tool for the 
  593. transformation of attributed trees which is based on pattern matching and unification.
  594. .ip "Transformation of Attributed Trees Using Pattern Matching"
  595. Also describes \fIpuma\fP using a more introductory style and compares it to similar tools.
  596. .ip "Specification of a MiniLAX-Interpreter"
  597. The annotated input to generate a compiler for the example language MiniLAX.
  598. .ip "BEG - a Back End Generator - User Manual"
  599. The user's manual of the back-end-generator \fIbeg\fP.
  600. .ip "Entwurf und Implementierung eines \*Ubersetzers von Modula-2 nach C"
  601. Diploma thesis in German about the design and implementation of the Modula-to-C translator
  602. \fImtc\fP.
  603. .lp
  604. For readers intending to use the tools the following documents are of primary interest:
  605. .(b
  606. .ta 3c
  607. intro    Toolbox Introduction
  608. toolbox    A Tool Box for Compiler Construction
  609. prepro    Preprocessors
  610. rex    Rex - A Scanner Generator
  611. lalr-ell    The Parser Generators Lalr and Ell
  612. ast    Ast - A Generator for Abstract Syntax Trees
  613. ag    Ag - An Attribute Evaluator Generator
  614. puma    Puma - A Generator for the Transformation of Attributed Trees
  615. begmanual    BEG - a Back End Generator - User Manual
  616. .)b
  617. .(z
  618. .PS
  619. linewid    = linewid * 1.2
  620. boxwid    = boxwid * 1.7
  621. boxht    = boxht * 1.2
  622. circlerad = circlerad * 1.2
  623. bh    = boxht * 1.7
  624. bw    = boxwid * 0.5
  625.  
  626.     right
  627.  
  628. S1:    box wid bw height bh invis
  629. SP:    box wid boxwid * 1.6 "Scanner spec:" "regular expressions"
  630.     arrow
  631. T:    circle "rex"
  632.     arrow
  633. I1:    box "Scanner"
  634.  
  635. S2:    box at S1 - (0, bh) wid bw height bh invis
  636. P:    box wid boxwid * 1.6 "Parser spec:" "concrete syntax (grammar)" "mapping: concrete \(-> abstract"
  637.     arrow
  638.     circle "lalr" "ell"
  639.     arrow
  640. I2:    box "Parser"
  641.  
  642. S3:    box at S2 - (0, bh) wid bw height bh invis
  643.     box wid boxwid * 1.6 "Tree spec:" "abstract syntax" "(grammar)"
  644.     arrow
  645.     circle "ast"
  646.     arrow
  647. I3:    box "Tree"
  648.  
  649. S4:    box at S3 - (0, bh) wid bw height bh invis
  650.     box wid boxwid * 1.6 "Semantics spec:" "attribute grammar"
  651.     arrow
  652.     circle "ag"
  653.     arrow
  654. I4:    box "Semantics"
  655.  
  656. S5:    box at S4 - (0, bh) wid bw height bh invis
  657.     box wid boxwid * 1.6 "Trafo spec:" "mapping:" "abstract \(-> intermediate"
  658.     arrow
  659.     circle "puma"
  660.     arrow
  661. I5:    box "Trafo"
  662.  
  663. S6:    box at S5 - (0, bh) wid bw height bh invis
  664.     box wid boxwid * 1.6 "Intermediate spec:" "intermediate language" "(grammar)"
  665.     arrow
  666.     circle "ast"
  667.     arrow
  668. I6:    box "Intermediate"
  669.  
  670. S7:    box at S6 - (0, bh) wid bw height bh invis
  671.     box wid boxwid * 1.6 "Codegenerator spec:" "mapping:" "intermediate \(-> machine"
  672.     arrow
  673.     circle "beg"
  674.     arrow
  675. I7:    box "Codegenerator"
  676.  
  677.     box invis "Specification" at SP + (0, bh)
  678.     box invis "Tool" at T + (0, bh)
  679.     box invis "Compiler" "Module" at I1 + (0, bh)
  680.  
  681.     line from I1.n up boxht * 0.9 <-
  682.     arrow from I1.s to I2.n
  683.     arrow from I2.s to I3.n
  684.     arrow from I3.s to I4.n <->
  685.     arc from I3.se to I5.ne at I4 -> cw
  686.     arrow from I5.s to I6.n
  687.     arrow from I6.s to I7.n
  688.     arrow from I7.s down boxht * 0.9
  689. .PE
  690. .sp 0.5
  691. .ce
  692. Fig. 1: Compiler Structure
  693. .)z
  694. .ne 2c
  695. Of secondary interest might be:
  696. .(b
  697. .ta 3c
  698. reuse    Reusable Software - A Collection of Modula-2-Modules
  699. scanex    Selected Examples of Scanner Specifications
  700. .)b
  701. The other documents either describe internals of the tools or are excerpts of the above.
  702. .sh 1 "Generating a Compiler"
  703. .lp
  704. A compiler usually consists of several modules where every module handles a certain task.
  705. The toolbox gives very much freedom for the design of a compiler and supports various
  706. structures.
  707. .pp
  708. Figure 1 presents our preferred compiler structure. In the right column are the main modules
  709. that constitute a compiler. The left column contains the necessary specifications. In
  710. between there are the tools which are controlled by the specifications and which produce the
  711. modules. The arrows represent the data flow in part during generation time and in part during
  712. run time of the compiler.
  713. .pp
  714. In principle the compiler model works as follows: A scanner and a parser read the source,
  715. check the concrete syntax, and construct an abstract syntax tree. They may perform several
  716. normalizations, simplifications, or transformations in order to keep the abstract syntax
  717. relatively simple. Semantic analysis is performed on the abstract syntax tree. Optionally
  718. attributes for code generation may be computed. Afterwards the abstract syntax tree is
  719. transformed into an intermediate representation. The latter is the input of the code generator
  720. which finally produces the machine code.
  721. .pp
  722. The picture in Figure 1 is relatively abstract by just listing the main tasks of a compiler.
  723. Every task is generated by a tool out of a separate specification which is oriented towards
  724. the problem at hand. The generation processes seem to be independent of each other.
  725. .(z
  726. .PS
  727. scale    = 2.54
  728. boxwid    = 2.0
  729. boxht    = 1.0
  730. circlerad = 0.75
  731. linewid    = 1.2
  732. lineht    = 0.75
  733.  
  734.     right
  735. SC:    box ".scan"
  736.     arrow
  737. RPP:    circle "rpp"
  738.     arrow
  739.     box ".rex"
  740.     arrow
  741. REX:    circle "rex"
  742.     arrow
  743.  
  744. PA:    box ".pars" at SC + (0, -4)
  745.     arrow
  746. XZ:    circle "cg -xz"
  747.     arrow
  748.     box ".lalr"
  749.     arrow
  750. LALR:    circle "lalr" "bnf"
  751.     arrow
  752.  
  753.     arrow at XZ.n up
  754.     box "Scanner" ".rpp"
  755.     arrow
  756.  
  757.     right
  758. DOT:    box ".ell" at PA + (0, -2)
  759. ELL:    circle "ell" at LALR + (0, -2)
  760.     arrow
  761.     arrow from DOT.e to ELL.w
  762.  
  763.     down
  764. AG:    circle "ag/cg" at XZ + (0, -4)
  765.     arrow
  766. STORE:    box ".ST"
  767.     arrow
  768. AST:    circle "ast/cg"
  769.     arrow
  770.     box ".TS"
  771.     arrow
  772. PUMA:    circle "puma"
  773.  
  774.     box ".cg" at STORE + (-3, 0)
  775.     arrow from last box.ne to AG.sw
  776.     arrow from last box.se to AST.nw
  777.     box ".puma" at PUMA + (-3, 0)
  778.     arrow from last box.e to PUMA.w
  779.  
  780. SO:    box "Source" at REX + (3, 0); arrow right at last box.e
  781. SCA:    box "Scanner" at last box + (0, -2); arrow right at last box.e
  782. PA:    box "Parser" at last box + (0, -2); arrow right at last box.e
  783. ER:    box "Errors" at last box + (0, -2); arrow right at last box.e
  784. EV:    box "Eval" at last box + (0, -2); arrow right at last box.e
  785. SU:    box "Support" at last box + (0, -2); arrow right at last box.e
  786. TR:    box "Tree" at last box + (0, -2); arrow right at last box.e
  787. RE:    box "Reuse" at last box + (0, -2); arrow right at last box.e
  788. TRA:    box "Trafo" at last box + (0, -2); arrow right at last box.e
  789.  
  790.     arrow from REX.se to SCA.nw
  791.     arrow from LALR.se to ER.nw
  792.     arrow from ELL.ne to PA.sw
  793.     arrow from AG.e to EV.w
  794.     arrow from AST.e to TR.w
  795.     arrow from PUMA.e to TRA.w
  796.  
  797.     down
  798.     arrow from SO + (boxwid * 0.5 + linewid, 0) to TRA + (boxwid * 0.5 + linewid, -1.5)
  799.     circle "compile" "+ link"
  800.     arrow
  801.     box ".exe"
  802. .PE
  803. .sp
  804. .ce
  805. Fig. 2: Interaction and data flow among the tools
  806. .)z
  807. .pp
  808. For a real user a more closer look than the one of Figure 1 is necessary. Figure 2
  809. describes the actual interaction among the tools.
  810. It describes the data flow starting from specifications and ending in
  811. an executable compiler. Boxes represent files, circles represent tools, and arrows show the
  812. data flow. The input specifications are contained in the files at the left-hand side.
  813. The tools generate modules containing source code in the implementation languages
  814. C or Modula-2. This modules are shown at the right-hand side. Every module conists
  815. of two files with the following suffixes:
  816. .ta 2c
  817. .ip "implementation language C:"
  818. \&.h    header or interface file
  819. .br
  820. \&.c    implementation part
  821. .ip "implementation language Modula-2:"
  822. \&.md    definition module
  823. .br
  824. \&.mi    implementation module
  825. .pp
  826. Files outside the left- and right-hand side columns contain intermediate data.
  827. The various kinds of information in the files are distinguished by different file types
  828. as explained in Table 2.
  829. The few dependencies between tools are shown by the data flow via intermediate files. 
  830. These dependencies are explained in more detail in the next sections.
  831. .(b L
  832. .sp 0.5
  833. .ce
  834. Table 2: File Types
  835. .sp 0.5
  836. .TS
  837. center box;
  838. l | l.
  839. Suffix    Meaning
  840. _
  841. \&.pars    scanner and parser specification (including S-attribution)
  842. \&.scan    rest of scanner specification
  843. \&.rpp    intermediate data: scanner description extracted from .pars
  844. \&.rex    scanner specification understood by \fIrex\fP
  845. \&.lalr    parser specification understood by \fIlalr\fP
  846. \&.ell    input for \fIell\fP (= input for \fPlalr\fP with EBNF constructs)
  847. \&.cg    input for \fIast\fP and \fIag\fP
  848. \&.puma    input for \fIpuma\fP
  849. \&.ST    intermediate data: storage assignment for attributes
  850. \&.TS    intermediate data: description of attributed tree
  851. _
  852. \&.h    C source: header or interface file
  853. \&.c    C source: implementation part
  854. \&.md    Modula-2 source: definition module
  855. \&.mi    Modula-2 source: implementation module
  856. \&.exe    compiled and linked executable compiler
  857. .TE
  858. .)b
  859. .sh 2 "Scanning and Parsing"
  860. .lp
  861. Two parser generators are contained in the toolbox. First, the user has to decide which one
  862. to use. I will not start arguing here in favour of one or the other grammar class.
  863. If I am asked, I recommend to use \fIlalr\fP. Both parser generators and their common
  864. input language (types .lalr and .ell) are documented in
  865. "The Parser Generators Lalr and Ell".
  866. From the syntactic point of view both tools understand almost the same input language. The
  867. only incompatibility concerns the different notation to access attributes. From the semantic
  868. point of view there are of course differences with respect to the grammar class and the kind
  869. of attribution evaluable during parsing. Whereas \fIlalr\fP accepts LALR(1) grammars and is able to
  870. evaluate and S-attribution (SAG), \fIell\fP accepts LL(1) grammars and is able to evaluate an
  871. L-attribution (LAG). Both, \fIlalr\fP and \fIell\fP generate a module with the default
  872. name \fIParser\fP which serves as basename for the file name, too. This module name can be
  873. chosen freely using an appropriate directive in the input of the parser generators.
  874. Both parser generators can also supply a module called \fIErrors\fP. This is a
  875. simple prototype for handling error messages that just prints the messages.
  876. However, it is recommended to use the more comfortable module \fIErrors\fP from the library
  877. .i reuse .
  878. In simple cases, this module is just linked to the user's program. If modifications are
  879. necessary this module should be copied from the library along with its companion module
  880. .i Positions
  881. into the user's directory. The module
  882. .i Positions
  883. defines a data structure to describe source positions.
  884. .pp
  885. The scanner generator \fIrex\fP and its input language (type .rex) are documented in
  886. "Rex - A Scanner Generator".
  887. \fIrex\fP generates a module with the default name \fIScanner\fP which serves as basename
  888. for the file name, too.
  889. .i rex
  890. can also generate a module called \fISource\fP which
  891. isolates the task of providing input for the scanner.
  892. By default it reads from a file or from standard input.
  893. Again, it is recommended to use the module \fISource\fP from the library
  894. .i reuse .
  895. In simple cases, this module is just linked to the user's program. If modifications are
  896. necessary or the module should provide input for a scanner with a name different to
  897. .i Scanner
  898. then this module must be requested from
  899. .i rex .
  900. .pp
  901. It is possible to combine several scanners and parsers either generated by
  902. .i lalr
  903. or
  904. .i ell
  905. into one program as long as different module names are chosen.
  906. .pp
  907. If the parser generator \fIell\fP is to be used, the inputs of \fIrex\fP and \fIell\fP have
  908. to be specified in the languages directly understood by these tools (types .rex and .ell).
  909. If the parser generator \fIlalr\fP is to be used, a more comfortable kind of input language is
  910. available. It is possible to extract most of a scanner specification out of a parser grammar.
  911. Therefore it is recommended to specify scanner and parser by two files of types .scan and
  912. \&.pars. Further advantageous of this approach are that concrete syntax, abstract syntax, and
  913. attribute grammar are written in one common language (types .pars and .cg) and that the
  914. attribution to be evaluated during parsing is written using named attributes.
  915. This attribution is checked for completeness and whether it obeys the SAG property.
  916. The language to describe concrete and abstract syntax is documented in:
  917. "Ast - A Generator for Abstract Syntax Trees".
  918. The addition of attribute declarations and attribute computations are documented in:
  919. "Ag - An Attribute Evaluator Generator".
  920. The use of this language especially as input for scanner and parser
  921. generation is documented in:
  922. "Preprocessors".
  923. This document also describes the preprocessors \fIcg -xz\fP and \fIrpp\fP. \fIcg -xz\fP
  924. converts input of type .pars into input directly understood by \fIlalr\fP (type .lalr)
  925. and it extracts most of the scanner specification which is written on the intermediate file
  926. named Scanner.rpp. The \fIrex\fP preprocessor \fIrpp\fP merges this extracted scanner
  927. specification with additional parts provided by the user (type .scan) and produces
  928. input directly understood by \fIrex\fP. The language in files of type .scan is an extension
  929. of the input language of \fIrex\fP. These extensions are also documented in:
  930. "Preprocessors".
  931. .(z L
  932. .sp 0.5
  933. .ce
  934. Table 3: Library Units Needed by Generated Modules
  935. .sp 0.5
  936. .TS
  937. center box;
  938. l | l | l | l.
  939. Tool    Module    C    Modula-2
  940. _
  941. rex    Source    System    System
  942. rex    Scanner    System, Source    System, Checks, Memory, Strings, IO,
  943.             Position, Source
  944. lalr    Parser    Memory, DynArray, Sets,    System, DynArray, Sets, Strings
  945.         Errors    Positions, Errors
  946. lalr    Errors    System, Sets, Idents,    System, Strings, Idents, Sets, IO,
  947.         Positions    Positions
  948. ell    Parser    Errors    System, Strings, Positions, Errors
  949. ell    Errors    System, Sets, Idents,    System, Strings, Idents, Sets, IO,
  950.         Positions    Positions
  951. reuse    Errors    System, Memory, Sets,    System, Memory, Strings, StringMem,
  952.         Idents, Positions    Idents, Sets, IO, Positions, Sort
  953. ast    Tree    System, General, Memory,    System, General, Memory, DynArray,
  954.         DynArray, StringMem,    IO, Layout, StringMem, Strings,
  955.          Idents, Sets, Positions    Idents, Texts, Sets, Positions
  956. ag    Eval    -    -
  957. puma    Trafo    System    System, IO
  958. .TE
  959. .)z
  960. .sh 2 "Semantic Analysis and Transformation"
  961. .lp
  962. Our preferred compiler design constructs an abstract syntax tree as underlying data structure
  963. for semantic analysis. Afterwards this tree is usually mapped to some kind of intermediate
  964. language by a phase termed transformation.
  965. .pp
  966. The syntax tree as central data structure is managed by the module \fITree\fP. This module
  967. is generated by the tool \fIast\fP out of a specification in a file of type .cg.
  968. The tool \fIast\fP and its input language are documented in:
  969. "Ast - A Generator for Abstract Syntax Trees".
  970. The construction of trees is usually done during parsing. It is specified within the semantic
  971. actions of the input of the parser generator.
  972. .pp
  973. One possibility for the specification of semantic analysis is the use of an attribute grammar.
  974. The tool \fIag\fP generates an evaluator module (named \fIEval\fP by default) out of an
  975. attribute grammar. As this tool also has to know the structure of the abstract syntax tree
  976. both, \fIast\fP and \fIag\fP usually process the same input file.
  977. The tool \fIag\fP and the extensions to the input language of \fIast\fP for attribute
  978. grammars are documented in:
  979. "Ag - An Attribute Evaluator Generator".
  980. .pp
  981. The optimizer of \fIag\fP decides how to implement attributes. They can be either stored
  982. in the tree or in global stacks or global variables. This information is communicated
  983. from \fIag\fP to \fIast\fP in files of type .ST. (This feature is not implemented yet.)
  984. .pp
  985. The tool \fIpuma\fP generates transformers (named \fITrafo\fP by default) that map
  986. attributed trees to arbitrary output. As this tool also has to know about the structure
  987. of the tree this information is communicated from \fIast\fP to \fIpuma\fP via a file
  988. of type .TS. The tool \fIpuma\fP and its input language are documented in:
  989. "Puma - A Generator for the Transformation of Attributed Trees".
  990. .pp
  991. The names of the modules produced by the tools \fIast\fP, \fIag\fP, and \fIpuma\fP can be
  992. controlled by directives in the
  993. input. Figure 2 uses the default names. By chosing different names it is possible
  994. to combine several tree modules, attribute evaluators, and transformers in one program.
  995. .(z L
  996. .sp 0.5
  997. .ce
  998. Table 4: Modules in the Library Reuse
  999. .sp 0.5
  1000. .TS
  1001. box center;
  1002. l | l | c | c.
  1003. Module    Task    C    Modula-2
  1004. _
  1005. Memory    dynamic storage (heap) with free lists              y    y
  1006. Heap    dynamic storage (heap) without free lists              -    y
  1007. DynArray    dynamic and flexible arrays                        y    y
  1008. Strings    string handling                                            -    y
  1009. StringMem    string memory                                  y    y
  1010. Idents    identifier table - unambiguous encoding of strings    y    y
  1011. Lists    lists of arbitrary objects                                 -    y
  1012. Texts    texts are lists of strings (lines)                        -    y
  1013. Sets    sets of scalar values (without run time checks)            y    y
  1014. SetsC    sets of scalar values (with run time checks)              -    y
  1015. Relations    binary relations between scalar values             -    y
  1016. IO    buffered input and output                                  -    y
  1017. StdIO    buffered IO for standard files                        -    y
  1018. Layout    more routines for input and output                        -    y
  1019. Positions    handling of source positions    y    y
  1020. Errors    error handler for parsers and compilers    y    y
  1021. Source    provides input for scanners    y    y
  1022. Sort    quicksort for arrays with elements of arbitrary type    -    y
  1023. System    interface to the operating system    y    y
  1024. General    miscellaneous functions                                  y    y
  1025. .TE
  1026. .)z
  1027. .sh 2 "Compiling and Linking"
  1028. .lp
  1029. All the source modules generated by the tools have to be compiled by a compiler appropriate
  1030. for the implementation language (C or Modula-2). Additional hand-written modules can be added
  1031. as necessary. In Figure 2 the module \fISupport\fP indicates this possibility.
  1032. In the last step all binaries have to be linked together with a few modules of the
  1033. library \fIreuse\fP to yield an executable compiler.
  1034. .pp
  1035. The use of modules from the library \fIreuse\fP depends on the implementation language and
  1036. the used tools. There is a C and a Modula-2 version of this library.
  1037. The Modula-2 version is documented in:
  1038. "Reusable Software - A Collection of Modula-2-Modules".
  1039. The C version is documented in:
  1040. "Reusable Software - A Collection of C-Modules".
  1041. Table 3 lists the library units needed by tool generated modules.
  1042. Additionally the user may engage further modules from this library for various tasks.
  1043. Table 4 lists the modules that might be of interest. The right-hand side columns describe the
  1044. availability of the modules with regard to the implementation language.
  1045. .sh 1 Makefile
  1046. .lp
  1047. The tools of the toolbox are conveniently controlled by the UNIX program make and an
  1048. appropriate makefile -
  1049. at least under the UNIX operating system. This eases the invocation of the tools and minimizes
  1050. the amount of regeneration after changes. Figure 2 can be used to derive a makefile because
  1051. it describes most of the dependencies among tools and files. The following makefiles control
  1052. the generation of compilers for the example language MiniLAX in the target languages C and
  1053. Modula-2.
  1054. The annotated specification of this language is documented in:
  1055. "Specification of a MiniLAX-Interpreter".
  1056. The makefiles are examples a user can start with.
  1057. .pp
  1058. The makefiles in the next sections deviate in the following from the fundamental structure
  1059. presented in Figure 2:
  1060. .ip -
  1061. The attribute evaluator module is called \fISemantics\fP instead of \fIEval\fP.
  1062. .ip -
  1063. The transformation module is called \fIICode\fP instead of \fITrafo\fP.
  1064. .ip -
  1065. The hand-written modules are called \fIICodeInter\fP and \fIminilax\fP.
  1066. The latter constitutes the main program.
  1067. .ip -
  1068. There are two support modules for semantic analysis called \fIDefinitions\fP and \fITypes\fP.
  1069. These are generated by tools (\fIast/cg\fP and \fIpuma\fP), too.
  1070. .sh 2 C
  1071. .lp
  1072. The macro LIB specifies the directory where the compiled library \fIreuse\fP is located. The
  1073. name of this library is \fIlibreuse.a\fP.
  1074. The -I flag in the macro CFLAGS specifies the directory where the header files
  1075. of the library modules are located.
  1076. .pp
  1077. The first command (target minilax) is for linking the compiled modules to an executable
  1078. compiler. The succeeding entries describe the dependencies during the generation phase and
  1079. the invocation of the tools.
  1080. The dependencies before the target lint are those needed during compilation.
  1081. .sp
  1082. .nf
  1083. .FT
  1084. LIB     = $(HOME)/lib
  1085. INCDIR  = $(LIB)/include
  1086. CFLAGS  = -I$(INCDIR)
  1087. CC      = cc
  1088.  
  1089. SOURCES = Scanner.h Scanner.c Parser.h Parser.c Tree.h Tree.c \\
  1090.           Semantics.h Semantics.c Types.h Types.c Definitions.h Definitions.c \\
  1091.           ICode.h ICode.c ICodeInter.h ICodeInter.c minilax.c
  1092.  
  1093. BINS    = minilax.o Scanner.o Parser.o Tree.o \\
  1094.           Types.o Definitions.o Semantics.o ICode.o ICodeInter.o
  1095. .bp
  1096. minilax:        $(BINS)
  1097.         $(CC) $(CFLAGS) $(BINS) $(LIB)/libreuse.a -o minilax -lm 
  1098.  
  1099. Scanner.rpp Parser.lalr:        minilax.pars
  1100.         cg -cxzj minilax.pars;
  1101.  
  1102. minilax.rex:    minilax.scan Scanner.rpp
  1103.         rpp < minilax.scan > minilax.rex;
  1104.  
  1105. Scanner.h Scanner.c:    minilax.rex
  1106.         rex -cd minilax.rex;
  1107.  
  1108. Parser.h Parser.c:      Parser.lalr
  1109.         lalr -c -d Parser.lalr;
  1110.  
  1111. Tree.h Tree.c:  minilax.cg
  1112.         cg -cdimRDI0 minilax.cg;
  1113.  
  1114. Semantics.h Semantics.c:        minilax.cg
  1115.         cg -cDI0 minilax.cg;
  1116.  
  1117. Definitions.h Definitions.c Definitions.TS:     Definitions.cg
  1118.         cg -cdim4 Definitions.cg;
  1119.  
  1120. Tree.TS:        minilax.cg
  1121.         echo SELECT AbstractSyntax Output | cat - minilax.cg | cg -c4
  1122.  
  1123. Types.h Types.c:        Types.puma Tree.TS
  1124.         puma -cdipk Types.puma;
  1125.  
  1126. ICode.h ICode.c:        ICode.puma Tree.TS Definitions.TS
  1127.         puma -cdi ICode.puma;
  1128.  
  1129. Parser.o:       Parser.h Scanner.h Tree.h Types.h Definitions.h
  1130. Semantics.o:    Semantics.h Tree.h Definitions.h Types.h
  1131. Tree.o:         Tree.h
  1132. Definitions.o:  Definitions.h Tree.h
  1133. Types.o:        Tree.h Types.h
  1134. ICode.o:        Tree.h Types.h ICodeInter.h
  1135. minilax.o:      Scanner.h Parser.h Tree.h Semantics.h Definitions.h ICode.h \\
  1136.                 ICodeInter.h Types.o
  1137.  
  1138. lint:   $(SOURCES)
  1139.         lint -I$(HOME)/reuse/c -u *.c
  1140.  
  1141. clean:
  1142.         rm -f Scan*.? Parser.? Tree.? Sema*.? Defi*.? Types.? ICode.? *.TS
  1143.         rm -f core _Debug minilax *Tab mini*.rex Parser.lalr Scan*.rpp yy*.w *.o
  1144.  
  1145. \&.c.o:
  1146.         $(CC) $(CFLAGS) -c $*.c;
  1147. .FR
  1148. .fi
  1149. .bp
  1150. .sh 2 Modula-2
  1151. .lp
  1152. The first command (target minilax) describes compilation and linking using the GMD Modula-2
  1153. compiler MOCKA. This compiler does its own dependency analysis among the sources. Therefore
  1154. the makefile does not contain any dependency descriptions between sources and binaries.
  1155. The -d flag of the compiler call mc specifies the directory where the library \fI reuse\fP is
  1156. located. The rest of the makefile describes the generation phase and the invocation of the
  1157. tools.
  1158. .sp
  1159. .nf
  1160. .FT
  1161. SOURCES = Scanner.md Scanner.mi Parser.md Parser.mi \\
  1162.           Tree.md Tree.mi Semantics.md Semantics.mi \\
  1163.           Types.md Types.mi Definitions.md Definitions.mi \\
  1164.           ICode.md ICode.mi ICodeInter.md ICodeInter.mi minilax.mi
  1165.  
  1166. minilax:        $(SOURCES)
  1167.         echo p minilax | mc -d ../../reuse/src
  1168.  
  1169. Scanner.rpp Parser.lalr:        minilax.pars
  1170.         cg -xzj minilax.pars;
  1171.  
  1172. minilax.rex:    minilax.scan Scanner.rpp
  1173.         rpp < minilax.scan > minilax.rex;
  1174.  
  1175. Scanner.md Scanner.mi Scanner.Tab:      minilax.rex
  1176.         rex -d minilax.rex;
  1177.  
  1178. Parser.md Parser.mi Parser.Tab: Parser.lalr
  1179.         lalr -d Parser.lalr;
  1180.  
  1181. Tree.md Tree.mi:        minilax.cg
  1182.         cg -dimRDI0 minilax.cg;
  1183.  
  1184. Semantics.md Semantics.mi:      minilax.cg
  1185.         cg -DI0 minilax.cg;
  1186.  
  1187. Definitions.md Definitions.mi Definitions.TS:   Definitions.cg
  1188.         cg -dim4 Definitions.cg;
  1189.  
  1190. Tree.TS:        minilax.cg
  1191.         echo SELECT AbstractSyntax Output | cat - minilax.cg | cg -4
  1192.  
  1193. Types.md Types.mi:      Types.puma Tree.TS
  1194.         puma -dipk Types.puma;
  1195.  
  1196. ICode.md ICode.mi:      ICode.puma Tree.TS Definitions.TS
  1197.         puma -di ICode.puma;
  1198.  
  1199. clean:
  1200.         rm -f Scan*.m? Parser.m? Tree.m? Sema*.m? Defi*.m? Types.m? ICode.m?
  1201.         rm -f core *.TS *.[dimor] _Debug minilax *Tab mini*.rex Parser.lalr Scan*.rpp
  1202. .FR
  1203. .fi
  1204.  
  1205. .bp 1
  1206. .lp
  1207. .b Contents
  1208. .sp
  1209. .xp
  1210.